#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void CantorTriangle(int num) {
	int sum = 0, cnt = 1, layers = 1;
	while (sum + layers < num) {
		sum += layers;
		layers++;
	}
	sum += layers;
	int r, c;
	if (layers % 2 == 1) {
		c = layers - sum + num  ;
		r = 1 + layers - c;
	}
	else {
		r = layers - sum + num  ;
		c = 1 + layers - r;
	}
	printf("%d %d", r, c);
}
int main() {
	int n = 0;
	scanf("%d", &n);
	CantorTriangle(n);
	return 0;
}